'''
@Owner dYrolign and DERFDY 2025.
@Author dYrolign.
@Contibutor iKeinsan, Werstog, Leoitsenn.
@Date 2025/10/15.
'''
lyrics ='Dashing through the snow, in a one-horse \
open sleigh. Over the fields we go, laughing all \
the way. Bells on bob-tails ring, making spirits \
bright, What fun it is to ride and sing a \
sleighing song tonight. Jingle bells, jingle \
bells, jingle all the way. Oh what fun it is to \
ride in a one horse open sleigh. Jingle bells, \
jingle bells, jingle all the way. Oh what fun it \
is to ride in a one horse open sleigh.'
#将歌词中涉及的标点利用replace()方法替换成空字符（注意：不是空格符）
for ch in ",.?!":
    lc = lyrics.replace(',','').replace('.','')

#用 split()函数可以拆分字符串，生成单词的列表
words=lc.split()

dict1={}
for i in words:
    try:
        dict1[i]+=1
    except:
        dict1.update({i:1})
#利用循环逐个读取列表中单词，并统计出现的次数，并将单词和对应的次数作为键值对添加到字典dict1中

items=list(dict1.items())
#对统计结果进行排序
dict2 = {k: v for k, v in sorted(dict1.items(), key=lambda x: x[1], reverse=True)}
items=list(dict2.items())

#打印控制
for item in items:
    word,count=item
    print("{:<12}{:>5}".format(word,count))